package leetcode4_1;

import common.ListNode;

/**
 * @author tmh
 * @date 2024/4/1 15:59
 * @description
 */
public class T206_反转链表 {
    public static void main(String[] args) {
        //生成一个链表，里面存放5个数据
        ListNode head = new ListNode(1);
        ListNode node2 = new ListNode(1);
        ListNode node3 = new ListNode(1);
        ListNode node4 = new ListNode(1);


    }
    public ListNode reverseList(ListNode head) {
        ListNode pre = null;
        ListNode cur = head;
        ListNode temp = null;
        while (cur != null) {
            temp=cur.next;
            cur.next=pre;
            pre=cur;
            cur=temp;
        }
        return pre;
    }
}
